package Interface

import (
	"github.com/spf13/viper"
	"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
	"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
	ocr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ocr/v20181119"
)

type OCRIntf interface {
	TXOCR(input *map[string]string) (any, error) // 这里传值的类型 和方法中必须一致
}

func TXOCRClient() *ocr.Client {
	credential := common.NewCredential(
		viper.GetString("teng-xun.secret_id"),
		viper.GetString("teng-xun.secret_key"),
	)

	// 实例化一个client选项，可选的，没有特殊需求可以跳过
	cpf := profile.NewClientProfile()
	cpf.HttpProfile.Endpoint = "ocr.tencentcloudapi.com"
	// 实例化要请求产品的client对象,clientProfile是可选的 TXOCRClient
	client, _ := ocr.NewClient(credential, "ap-shanghai", cpf)

	return client
}
